<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title></title>
    <include file="Pub:style"/>
    <script>
        $(document).ready(function(){
            $(".setNum").click(function(){
                var lid=$(this).attr("data-id");
                var num=$(this).prev().val();
                var obj=$(this);
                $.ajax({
                    url:"__URL__/setNumber",
                    type:'get',
                    dataType:'json',
                    data:{num:num,lid:lid},
                    success:function(data){
                        if(data.error==0){
                            obj.parent().parent().text(num);
                            alert("设置成功");
                        }
                    }
                });
            });
        });
    </script>
</head>
<body>
<div class="container">
    <a href="__URL__/add/">添加抽奖</a>
    <table class="table table-striped">
        <tr>
            <td>ID</td>
            <td>名称</td>
            <td>开始时间</td>
            <td>截止时间</td>
            <td>中奖号码</td>
            <td>添加时间</td>
            <td>操作</td>
        </tr>
        <volist name="list" id="vo">
            <tr>
                <td>{$vo.id}</td>
                <td><a href="__URL__/index/pid/{$vo.id}">{$vo.title}</a></td>
                <td>{$vo.start_time|date="Y-m-d",###}</td>
                <td>{$vo.end_time|date="Y-m-d",###}</td>

                <td>
                    <empty name="vo.number">
                        <div class="input-append">
                                <input class="span2" id="lottery_number" type="text"/>
                                <input class="btn setNum" type="button"  value="Go!" data-id="{$vo.id}"/>
                        </div>
                    <else/>
                        {$vo.number}
                    </empty>
                </td>
                <td>{$vo.add_time|date="Y-m-d",###}</td>
                <td><a class="btn btn-primary" href="__URL__/edit/id/{$vo.id}">编辑</a>
                    <a class="btn btn-danger" href="__URL__/foreverdelete/id/{$vo.id}">删除</a>
                </td>
            </tr>
        </volist>
    </table>
</div>
</body>

</html>